import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _class;

/**
 * FIXME: 在使用 IconFont 后 需要换种方式使用 icon
 */
import React, { PureComponent } from 'react';
import { Col, Drawer, Pagination, Row } from 'antd';
import { Bind } from 'lodash-decorators';
import Icons from 'components/Icons';
import intl from 'utils/intl';
import styles from "./index.less?modules";
var viewMessagePrompt = 'ciam.menuConfig.view.message';
var IconList = (_dec = Bind(), _dec2 = Bind(), (_class = /*#__PURE__*/function (_PureComponent) {
  _inherits(IconList, _PureComponent);

  var _super = _createSuper(IconList);

  function IconList(props) {
    var _this;

    _classCallCheck(this, IconList);

    _this = _super.call(this, props);
    _this.state = {
      page: 0 // 当前分页

    };
    return _this;
  }

  _createClass(IconList, [{
    key: "cancel",
    value: function cancel() {
      var _this$props$onCancel = this.props.onCancel,
          onCancel = _this$props$onCancel === void 0 ? function (e) {
        return e;
      } : _this$props$onCancel;
      onCancel();
    }
  }, {
    key: "onPaginationChange",
    value: function onPaginationChange(current) {
      this.dynamicImport(current - 1);
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          visible = _this$props.visible,
          _this$props$onCancel2 = _this$props.onCancel,
          onCancel = _this$props$onCancel2 === void 0 ? function (e) {
        return e;
      } : _this$props$onCancel2;
      var _this$state = this.state,
          _this$state$page = _this$state.page,
          page = _this$state$page === void 0 ? 0 : _this$state$page,
          _this$state$total = _this$state.total,
          total = _this$state$total === void 0 ? 0 : _this$state$total;
      var paginationProps = {
        size: 'small',
        current: page + 1,
        total: total,
        pageSize: 12,
        showSizeChanger: false,
        onChange: this.onPaginationChange
      };
      return /*#__PURE__*/React.createElement(Drawer, {
        destroyOnClose: true,
        width: 600,
        title: intl.get("".concat(viewMessagePrompt, ".title.selectIcons")).d('选择图标'),
        visible: visible,
        onClose: onCancel,
        wrapClassName: styles['menu-icon-container']
      }, /*#__PURE__*/React.createElement(Row, {
        type: "flex",
        justify: "start",
        gutter: 12,
        className: styles.row
      }, /*#__PURE__*/React.createElement(Col, {
        span: 4,
        className: styles.col
      }, /*#__PURE__*/React.createElement(Icons, {
        size: 24,
        className: styles['menu-icon']
      }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", {
        style: {
          textAlign: 'right'
        }
      }, /*#__PURE__*/React.createElement(Pagination, paginationProps)));
    }
  }]);

  return IconList;
}(PureComponent), (_applyDecoratedDescriptor(_class.prototype, "cancel", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "cancel"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onPaginationChange", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "onPaginationChange"), _class.prototype)), _class));
export { IconList as default };